import {ColumnsType} from "antd/es/table";
import {Space} from "antd";
import {Link} from "react-router-dom";
import {ClientInfo} from "type/ClientInfo";
import {ellipsisHandler} from "../util/ColumnsUtil";

const clientInfoColumns: ColumnsType<ClientInfo> = [
    {
        title: '序号' ,
        dataIndex: 'index',
        width: 60,
        align: "center" ,
        render: (_, __, index) => <strong>{index + 1}</strong>
    },
    {
        title: '编号',
        dataIndex: 'id',
        key: 'id',
        width: 110,
        align: "center" ,
    },
    {
        title: '客户名称',
        dataIndex: 'clientName',
        key: 'clientName',
        width: 110,
        align: "center" ,
    },
    {
        title: '客户类型',
        dataIndex: 'clientType',
        key: 'clientType',
        width: 110,
        align: "center" ,
    },
    {
        title: '客户负责人',
        dataIndex: 'clientPrincipal',
        key: 'clientPrincipal',
        width: 110,
        align: "center" ,
    },
    {
        title: '负责人职务',
        dataIndex: 'personJob',
        key: 'personJob',
        width: 110,
        align: "center" ,
    },
    {
        title: '客户地址',
        dataIndex: 'clientAddress',
        key: 'clientAddress',
        width: 110,
        align: "center" ,
    },
    {
        title: '联系方式',
        dataIndex: 'clientContact',
        key: 'clientContact',
        width: 110,
        align: "center" ,
    },
    // {
    //     title: '排序',
    //     dataIndex: 'order',
    //     key: 'order',
    //     width: 110,
    //     align: "center" ,
    // },
    {
        title: '备注',
        dataIndex: 'remark',
        key: 'remark',
        width: 110,
        ellipsis: {showTitle: false},
        render: ellipsisHandler
    },
    {
        title: '操作',
        dataIndex: 'option' ,
        width: 100,
        align: "center",
        render: (_, record) => {
            return <Space>
                <Link key={"menu-update"} to={"./update/" + record.id}>更新</Link>
                <Link style={{color: '#D12'}} key={"menu-delete"} to={"./delete"} state={record}>删除</Link>
            </Space> ;
        }
    }
]
export default clientInfoColumns;
